package me.a_littlesquid.origin.utils;


import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;

import java.io.File;


import static org.bukkit.potion.PotionEffectType.*;

public class remove {
    public static void removepotion(Player player, FileConfiguration data, File filedata){
        String playername=player.getDisplayName();
        LivingEntity entity=player;
        String value=data.getString("playerlist."+playername+".origin");
        switch (value) {
            case "ck":
                entity.removePotionEffect(INCREASE_DAMAGE);
                entity.removePotionEffect(SPEED);
                entity.removePotionEffect(FAST_DIGGING);
                entity.removePotionEffect(SATURATION);
                break;
            case "zt":
                entity.removePotionEffect(DAMAGE_RESISTANCE);
                entity.removePotionEffect(SLOW);
                entity.removePotionEffect(HUNGER);
                break;
            case "zzgw":
                entity.removePotionEffect(WEAKNESS);
                entity.removePotionEffect(SPEED);
                break;
            case "xt":
                entity.removePotionEffect(REGENERATION);
                entity.removePotionEffect(INCREASE_DAMAGE);
                entity.removePotionEffect(FAST_DIGGING);
                entity.removePotionEffect(SPEED);
                entity.removePotionEffect(HUNGER);
                break;
            case "qs":
                entity.removePotionEffect(SPEED);
                entity.removePotionEffect(DAMAGE_RESISTANCE);
                entity.removePotionEffect(INCREASE_DAMAGE);
                entity.removePotionEffect(SLOW_FALLING);
                break;
            case "my":
                entity.removePotionEffect(SPEED);
                entity.removePotionEffect(DAMAGE_RESISTANCE);
                break;
            case "zs":
                entity.removePotionEffect(DAMAGE_RESISTANCE);
                break;
            case "pt":
                break;
        }
    }
    public static void removeequipment(Player player){
        PlayerInventory playerInventory=player.getInventory();
        ItemStack[] list=playerInventory.getContents();
        for (ItemStack item:list){
            if(item!=null){
                if (item.getItemMeta().isUnbreakable()){
                    playerInventory.remove(item);
                }
            }
        }
    }
}
